package com.cheikh.lazywaimai.network.service;

import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import rx.Observable;
import com.cheikh.lazywaimai.model.bean.Order;
import com.cheikh.lazywaimai.model.bean.ResultsPage;
import com.cheikh.lazywaimai.model.bean.SettleResult;

public interface OrderService {

    @FormUrlEncoded
    @POST("api/orders/check")
    Observable<SettleResult> settle(@Field("businessId") String businessId,
                                    @Field("payMethod") int payMethod,
                                    @Field("productList") String productListJson);

    @FormUrlEncoded
    @POST("api/orders/submit")
    Observable<Order> submit(@Field("cartId") String cartId,
                             @Field("bookTime") long bookedAt,
                             @Field("remark") String remark);

    @GET("api/orders/all")
    Observable<ResultsPage<Order>> orders(@Query("page") int page, @Query("size") int size);

    @GET("api/orders/cartInfo/{id}")
    Observable<Order> detail(@Path("id") String orderId);

    @FormUrlEncoded
    @POST("api/orders/payments")
    Observable<Object> payment(@Field("orderId") String orderId,
                               @Field("platformId") String platformId,
                               @Field("amount") double amount);
}